package com.bkgy.modular.upAndDownLine.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bkgy.modular.upAndDownLine.entity.UpAndDownLine2130;
import com.bkgy.modular.upAndDownLine.mapper.UpAndDownLine2130Mapper;
import com.bkgy.modular.upAndDownLine.service.UpAndDownLine2130Service;
import com.bkgy.sys.common.entity.ResultData;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import javax.annotation.Resource;

/**
 * @author ZhuHongKai
 * @version 1.0
 * @ClassName UpAndDownLine2130ServiceImpl
 * @date 2023/1/4 9:49
 */
@Service
public class UpAndDownLine2130ServiceImpl extends ServiceImpl<UpAndDownLine2130Mapper, UpAndDownLine2130> implements UpAndDownLine2130Service {
    @Resource
    private UpAndDownLine2130Mapper upAndDownLine2130Mapper;
    @Override
    public ResultData findUpAndDownLine2130(JSONObject jsonObject) {
        String hot_coil_id = jsonObject.getString("hot_coil_id");
        // 检查hot_coid_id是否为null或者为空
        if (StringUtils.isEmpty(hot_coil_id)) {
            return ResultData.ResultDataFaultSelf("传入卷号不得为空",null);
        }
        LambdaQueryWrapper<UpAndDownLine2130> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(UpAndDownLine2130::getHot_coil_id,hot_coil_id);
        UpAndDownLine2130 list = upAndDownLine2130Mapper.selectOne(queryWrapper);
        return ResultData.ResultDataFaultSelf("查询成功",list);
    }
}
